using System.Collections.Generic;
using wpffc.contracts.domaindata;

namespace wpffc.flashcardbox.domaindata
{
    public class Compartment : ICompartment
    {
        private readonly Queue<Card> _cards;
        private readonly int _fullCount;


        public Compartment(int fullcount) : this(new Queue<Card>(), fullcount){}
        internal Compartment(Queue<Card> cards, int fullcount)
        {
            _cards = cards;
            _fullCount = fullcount;
        }


        public void Enqueue(Card card)
        {
            _cards.Enqueue(card);
        }

        public Card Dequeue()
        {
            return _cards.Dequeue();
        }

        public CompartmentStatus Status
        {
            get 
            {
                if (_cards.Count == 0) return CompartmentStatus.Empty;
                if (_cards.Count < _fullCount) return CompartmentStatus.Filled;
                return CompartmentStatus.Full;
            }
        }
    }
}